package ControlLayer;

import DBLayer.DBReservation;
import DBLayer.DBReservationRelation;
import DBLayer.IFDBReservation;
import DBLayer.IFDBReservationRelation;
import ModelLayer.Employee;
import ModelLayer.Reservation;
import ModelLayer.ReservationRelation;
import java.util.ArrayList;

/**
 *
 * @author gartner
 */
public class CtrReservation {
    
    public Reservation findReservation(int rId)
    {
        IFDBReservation dbRes = new DBReservation();
        return dbRes.findReservation(rId, true);
    }
    
    public ArrayList getAllReservation()
    {
      IFDBReservation dbRes = new DBReservation();
      ArrayList allRes = new ArrayList();
      allRes = dbRes.getAllReservation(false);
      return allRes;
    }
    
    
    public void updateReservation( String date, Employee empID,String jobType,String timePeriod)
    
    {
        IFDBReservation dbRes = new DBReservation();
	
        Reservation res = new Reservation();
        
	res.setDate(date);
        res.setEmpID(empID);
        res.setJobType(jobType);
        res.setTimePeriod(timePeriod);
        
                
	dbRes.updateReservation(res);
    }  
    
    public void deleteReservation(int reservationID) 
     {
	IFDBReservation dbRes = new DBReservation();
	 dbRes.deleteReservation(reservationID);
    }
    
    
          public int getMaxID()
    {
        IFDBReservation dbRes = new DBReservation();
        int id = dbRes.MaxID();
        return id;
    }
    
          
     public void insertReservation(Reservation reservationObj) 
    {
	IFDBReservation dbRes = new DBReservation();
        dbRes.insertReservation(reservationObj);
     }
    
          
     public void insertReservationRelation(ReservationRelation rrObj)
        {
         IFDBReservationRelation dbResrel = new DBReservationRelation();
         dbResrel.insertReservationRelation(rrObj);
        }
     
        public ReservationRelation findReservationRR(int rId)
    {
        IFDBReservationRelation dbResrelat = new DBReservationRelation();
        return dbResrelat.findReservationRR(rId, true);
    }  
}